import unittest
from api.home import HomeAPI
class TestHomeAPI(unittest.TestCase):
    def setUp(self) -> None:
        self.home_api = HomeAPI()
    def tearDown(self) -> None:
        pass

    #获取轮播图·
    def test01_get_banner(self):
        response = self.home_api.get_banner()
        print(response.json())
        #断言
        self.assertEqual(200,response.status_code)
        self.assertIn("轮播图",response.json().get("description"))
    def test02_get_theme(self):
        response = self.home_api.get_theme()
        print(response.json())
        self.assertEqual(200,response.status_code)
        self.assertIn("专题栏",response.json()[0].get("name"))
    def test03_get_recent(self):
        response = self.home_api.get_recent()
        print(response.json())
        self.assertEqual(200,response.status_code)
        self.assertIn("半斤",response.json()[0].get("name"))